tests/sizes: Test sizes metadata with existing objects
authorDan Nicholson <nicholson@endlessm.com>
Tue, 22 Oct 2019 21:14:58 +0000 (15:14 -0600)
committerDan Nicholson <nicholson@endlessm.com>
Tue, 21 Jan 2020 03:42:27 +0000 (20:42 -0700)
Repeat the commit to make sure that the files are enumerated again for
the size metadata.

tests/test-sizes.js

index 622c2d1b603cf921047030a21a43fb8566495b20..a3928fe8eacfb9d7be33af873227303c6721f581 100755 (executable)
@@ -118,7 +118,7 @@ function validateSizes(repo, commit, expectedFiles) {
     }
 }
 
-print('1..1')
+print('1..2')
 
 let testDataDir = Gio.File.new_for_path('test-data');
 testDataDir.make_directory(null);
@@ -156,3 +156,17 @@ let expectedFiles = {
 validateSizes(repo, commit, expectedFiles);
 
 print("ok test-sizes");
+
+// Repeat the commit now that all the objects are cached and ensure the
+// metadata is still correct
+repo.prepare_transaction(null);
+mtree = OSTree.MutableTree.new();
+repo.write_directory_to_mtree(testDataDir, mtree, commitModifier, null);
+[,dirTree] = repo.write_mtree(mtree, null);
+[,commit] = repo.write_commit(null, 'Another subject', 'Another body', null, dirTree, null);
+print("commit => " + commit);
+repo.commit_transaction(null);
+
+validateSizes(repo, commit, expectedFiles);
+
+print("ok test-sizes repeated");